UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4nO66pqcN9+tUENrGIehFZptKJgmmxhyjFP+FO7s6Mk=' 
WHERE 
  key_id = 'f7fce2b50e2a17a33f6c86ce7c831bf630c3725f70d4cab45c08a63a2b60941c' 
  AND (
    token = '4nO66pqcN9+tUENrGIehFZptKJgmmxhyjFP+FO7s6Mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024