UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R1RusLhMwLKm+nqJH3Ah5M+ZbN9l2tO5ytmSXdx5/9U=' 
WHERE 
  key_id = '1b81db7431374b58625398f068f6a9b82d111d3522015556b4af3cfc13d4c09b' 
  AND (
    token = 'R1RusLhMwLKm+nqJH3Ah5M+ZbN9l2tO5ytmSXdx5/9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034