UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tVkSVfxlySRdki4ml5Nrl5pIKI3hdUZVH58zHprQtk0='
WHERE
key_id = '50f565812ec7f5cc3e73e5f82eb6e9c4b85f43ca3041120a7f55c90e35faded1'
AND (
token = 'tVkSVfxlySRdki4ml5Nrl5pIKI3hdUZVH58zHprQtk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)