UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3dCoHiN7fyDDn4wq6HHLac2ZdwX/fA83WCHNfcKdSgU='
WHERE
key_id = 'f34c2a13f494b745b78baff9cb8ecda3b5071c438ef85e2d3fa9fd1890b89782'
AND (
token = '3dCoHiN7fyDDn4wq6HHLac2ZdwX/fA83WCHNfcKdSgU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)