UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ef9svhNh1fQw0D9Mb0jsPjWw5NdsUKcxxVgBcD4RjAs=' 
WHERE 
  key_id = '2fe652ddbda51383ab19cdb80f111817834decff285c16a8f4aa67aeb1aaeb48' 
  AND (
    token = 'ef9svhNh1fQw0D9Mb0jsPjWw5NdsUKcxxVgBcD4RjAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021