UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'whCNnNfqXgj89hrmFJNGr/yz5WKIIuRxbobB6b87HJU='
WHERE
key_id = '52e46fe74e9b7e88290035850f83b0e15aeb6c7b7f3daf576ddd055fec8d5245'
AND (
token = 'whCNnNfqXgj89hrmFJNGr/yz5WKIIuRxbobB6b87HJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)