UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pBebqJsMFoUGsWBZl9ysTv6Qw+xAbj3WqNWq+nkYAvM=' 
WHERE 
  key_id = '01fbafd4764774a42957bf5b0653071c80e04022dc46f9297e99eb49f82a606d' 
  AND (
    token = 'pBebqJsMFoUGsWBZl9ysTv6Qw+xAbj3WqNWq+nkYAvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030