UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qk1hhSVxV9s7OtCC0Is/D5urFK6dey8EQrKVquXEMFU='
WHERE
key_id = 'f1059c37914f5cabfc54fdbe63ebe64e24217136abc5dd65e9c19a50c2d29867'
AND (
token = 'Qk1hhSVxV9s7OtCC0Is/D5urFK6dey8EQrKVquXEMFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)