UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AmdS8+4qX+L4OOSgqju1kWkT4evMwS7zXuvBiGwF6no='
WHERE
key_id = '09e975a763fece347e0c9b9ad0b2c6a336765610c8e2237997a5a6a52f96d0c8'
AND (
token = 'AmdS8+4qX+L4OOSgqju1kWkT4evMwS7zXuvBiGwF6no='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)