UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jxpWM1SH+WR+5FTlmetDI9Q/jH412Zv2y3TCGXtQWIQ=' 
WHERE 
  key_id = '19e78a7ff36e3e943586ffa3fe499a20587ecafee4edf9f776eaa3ba0bde107c' 
  AND (
    token = 'jxpWM1SH+WR+5FTlmetDI9Q/jH412Zv2y3TCGXtQWIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024