UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b5ZuxwwCuYi4dtEFTSTVKqxoezliefJE1VhwdGBZStA=' 
WHERE 
  key_id = '0d50c48cb391d0bf5ce7944774542c788ac61725e1366d25dcc345c2994c8ac6' 
  AND (
    token = 'b5ZuxwwCuYi4dtEFTSTVKqxoezliefJE1VhwdGBZStA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031