UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xh9UMcQ3y+g1X1DakSR62grWogfcibcZpUzV7KsMavg=' 
WHERE 
  key_id = 'cfb9f77e97135e6956402c558e9da7f982cc087a081503a823840c11c4634751' 
  AND (
    token = 'Xh9UMcQ3y+g1X1DakSR62grWogfcibcZpUzV7KsMavg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032