UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xfNaHl0i0m1Oq1TO/0g+9kCjA7RkaN0d8w92ZZHxc4M=' 
WHERE 
  key_id = 'a34012096b5c23a823401d2c6cd709942206fd005abee22bc337ea7d8139eb4c' 
  AND (
    token = 'xfNaHl0i0m1Oq1TO/0g+9kCjA7RkaN0d8w92ZZHxc4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031