UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HQWLA4yg9ABxpJatEU5Eno5HCOTnQhqL0gX5VQ9cGMM=' 
WHERE 
  key_id = '077c07dfcd2e272fcf4a17b53faf852794a2729a85a80f47d606a1fec99dc7b2' 
  AND (
    token = 'HQWLA4yg9ABxpJatEU5Eno5HCOTnQhqL0gX5VQ9cGMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024