UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2iU32XUxl5qtNYwFe2kmsafcjVLl7gI4zFRxmEaD/M='
WHERE
key_id = 'dc505f41522fbaf34cf25002c7a3f75901992d5acf349b1390fcf77e82586bf3'
AND (
token = 'a2iU32XUxl5qtNYwFe2kmsafcjVLl7gI4zFRxmEaD/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)