UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uFnVV/hwMw81j9qLY2OgjN2AIsxN/OHC9h2H/J+27Vg=' 
WHERE 
  key_id = '5a2bc44e2d8c79dbf89176b052bf2e4ca183339e23df4917f401c62892765849' 
  AND (
    token = 'uFnVV/hwMw81j9qLY2OgjN2AIsxN/OHC9h2H/J+27Vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047