UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5Zmvo2pD9ouDLqdOE3MKp7hlJWMTFIPbiLFCtA8GPQ=' 
WHERE 
  key_id = 'efea2b2e1027987433294643438f1a5bf540fe163cf5ad8163710e9132d42583' 
  AND (
    token = 'A5Zmvo2pD9ouDLqdOE3MKp7hlJWMTFIPbiLFCtA8GPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042