UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L1ufIpKWXWZjx/RUULdDbZSXeFt3+G7xnVffSDmsvUE=' 
WHERE 
  key_id = '07cfa619c08253bd53b2adc853c3a53d98b23ee7f618348e85dbd90498542285' 
  AND (
    token = 'L1ufIpKWXWZjx/RUULdDbZSXeFt3+G7xnVffSDmsvUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030