UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ddyyc5G65t3XCRNLOc/sP34+aE4p3lKihV3NWxPlj9E='
WHERE
key_id = '42e7a5b64e2717ed0e9154b057ea36940f58219fa3b9a606c342522e4f1013cd'
AND (
token = 'ddyyc5G65t3XCRNLOc/sP34+aE4p3lKihV3NWxPlj9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)