UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bgkonxXcgUH5kHCvG+0k/iCMeyATZUOb5SlVWU87aMI='
WHERE
key_id = '47fc368fdbf0bf89af65653d8478df34804e1fbe5c53d9f2ce7a6945564ff9e0'
AND (
token = 'bgkonxXcgUH5kHCvG+0k/iCMeyATZUOb5SlVWU87aMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)