UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gtmtcgTWz2cbfMt9LSdQHobeJ5RiyntLdZ0lUs8Zaec=' 
WHERE 
  key_id = '3967e48806e80243a210c9fa7e87183d98fd1e91c96e4c41fc410acbed41cefa' 
  AND (
    token = 'gtmtcgTWz2cbfMt9LSdQHobeJ5RiyntLdZ0lUs8Zaec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030