UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K128OoZhcp4mFnU2poalbjy7QakG5XvACjlwbH4pB3Y=' 
WHERE 
  key_id = 'b25ff7ac1d23ed7192ec7c57ca9a72127f919bd56ee3a4def1fd7f4940412cb4' 
  AND (
    token = 'K128OoZhcp4mFnU2poalbjy7QakG5XvACjlwbH4pB3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053