UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V+nYlW7Qxl1ZZ4z11y4Fc2nKsYA+uqHaLfl8R4edbSg=' 
WHERE 
  key_id = 'fc50db6570fafe8a5da6b3d8807bf40877b790b15f68af130c25b9432c380088' 
  AND (
    token = 'V+nYlW7Qxl1ZZ4z11y4Fc2nKsYA+uqHaLfl8R4edbSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049