UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jydsDWhwv6GpFYOM5cn5k4g4FJr+u6nJ2ZRls43Pg3g=' 
WHERE 
  key_id = 'cb7cecaf5cfce786347ce7da1423d40a9059223dba2e447ffd171d932907cb45' 
  AND (
    token = 'jydsDWhwv6GpFYOM5cn5k4g4FJr+u6nJ2ZRls43Pg3g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049