UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8qu8vK+iB91yev/fE/jfi9P1rbelO8UbGjfwpTBwqU=' 
WHERE 
  key_id = '2f5e03a80217c336d02c2d0f4ddbb5aefe0426361b4dd188dcd7bfbee010c0b5' 
  AND (
    token = 'J8qu8vK+iB91yev/fE/jfi9P1rbelO8UbGjfwpTBwqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032