UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sKBWCUtgLOP3u9wbJEmuIo9nb331+g8T5sP9ZFKyOFc=' 
WHERE 
  key_id = '1be8f1024f98d8085e6285e54faf43569bc7f47d71f07ad846015610c1d91700' 
  AND (
    token = 'sKBWCUtgLOP3u9wbJEmuIo9nb331+g8T5sP9ZFKyOFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034