UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHSf+me4Z5xvDlP5KsR1+8SBfRxzs5+75Vo1jBJoAvw=' 
WHERE 
  key_id = '1c879afbaf22dcd4225454c248ed4ad74a24298686758b91f2a208225ad41015' 
  AND (
    token = 'aHSf+me4Z5xvDlP5KsR1+8SBfRxzs5+75Vo1jBJoAvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040