UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k51TPBa3xFvE/WTeVnu4WO/mEHjTIpR/a+zawZJsgnw=' 
WHERE 
  key_id = '8b3e39158414aa2734a98fe6dd0dd09a064a4eab372648568d406fb7521ea629' 
  AND (
    token = 'k51TPBa3xFvE/WTeVnu4WO/mEHjTIpR/a+zawZJsgnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035