UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tt0M4VK66PfmGg7SpNOFIBfPp+4BAPsk3ym9YPIxojw='
WHERE
key_id = 'eef9a2c6b0785bdd9bc509bc88cfb23f88fe1f2976728cc512929c9fc2b9efd8'
AND (
token = 'tt0M4VK66PfmGg7SpNOFIBfPp+4BAPsk3ym9YPIxojw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)