UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'meMd/6aQiQPY+EvtjfvO8TMSI5GqHW/8YkILlPxvbXo=' 
WHERE 
  key_id = '1091dce89209d1d97baa2adbf7c027058c500abae1034dd1a1b99866e6190eb9' 
  AND (
    token = 'meMd/6aQiQPY+EvtjfvO8TMSI5GqHW/8YkILlPxvbXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025