UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SfoB48DnJSE20s0FOYA6Y3Cc8UX2uI7L/t0NR0UqH+0=' 
WHERE 
  key_id = '43360d684b3608fbf23e44ff4b4adae25f16756cea9084e953c5c81fe7a42ae6' 
  AND (
    token = 'SfoB48DnJSE20s0FOYA6Y3Cc8UX2uI7L/t0NR0UqH+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041