UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SQrAujA4ayDJ+xiabOKGMxP+LE3CC5Rb3gh87/3aXtM='
WHERE
key_id = '9318361abbe0677dfb6e3d05b1b144f31d731d7befd42699274777d7e5c4db70'
AND (
token = 'SQrAujA4ayDJ+xiabOKGMxP+LE3CC5Rb3gh87/3aXtM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)