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

Query time 0.00037