UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'joBDVRFAlpyDVYCjI8obGxIf/xSdpj6GGYh9ih94eWg=' 
WHERE 
  key_id = '15aef6bff4aa6d15939a62a8c0d54fd819026045c9aaa3037a955a972409b5d5' 
  AND (
    token = 'joBDVRFAlpyDVYCjI8obGxIf/xSdpj6GGYh9ih94eWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036