UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bFzb0hiemJjejLOhphA97KnQhHDt05sfP5FZI0MDe8I=' 
WHERE 
  key_id = '8cada700a0bfb3ee08f6e40d32de3af5e4135e81c0d0750401604527a7793df5' 
  AND (
    token = 'bFzb0hiemJjejLOhphA97KnQhHDt05sfP5FZI0MDe8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026