UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GpKH3179PNKytCl5ltxsxDHgliNebQh4RbnkEHfTNtE=' 
WHERE 
  key_id = '6b661f9c4b42e2cbaf017355ecc293c2017f023bb4e75d4c12a1963ea6c59529' 
  AND (
    token = 'GpKH3179PNKytCl5ltxsxDHgliNebQh4RbnkEHfTNtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028