UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rMvacVeOicqmh4dg6T0RE5MhfV237OcCLtAxv579Ij4=' 
WHERE 
  key_id = '66ca1f5b717cc5b9d31d66088e57b21180e8850b96c68d6b4e5920105d63f88a' 
  AND (
    token = 'rMvacVeOicqmh4dg6T0RE5MhfV237OcCLtAxv579Ij4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058