UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3DJdPFk7CrPHgYInt2DArF2n9eg5NUGO+UH/XDiUJac=' 
WHERE 
  key_id = '596aef74aab68f44b8404471dee33c4fd1e4e855cc0769508ed9daef8224e250' 
  AND (
    token = '3DJdPFk7CrPHgYInt2DArF2n9eg5NUGO+UH/XDiUJac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048