UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CbaDyJH4N9QI2WGenjji8dde7hWVfk9SxBU0bDBBrno=' 
WHERE 
  key_id = 'cf1e66944c81fb4ec888e9d07f24163e556d2eb60eedc8dc0874bc0bc56ec18d' 
  AND (
    token = 'CbaDyJH4N9QI2WGenjji8dde7hWVfk9SxBU0bDBBrno=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048