UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FO59WGNVYgyobi9dxRig4Q5W5SADD/MmnEuY7D3zVVY='
WHERE
key_id = 'bf09e6a17c256502da695197d80f4f7ecf424fc6252b961aead2cd30cee2a4d2'
AND (
token = 'FO59WGNVYgyobi9dxRig4Q5W5SADD/MmnEuY7D3zVVY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)