UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TrPs63TCrfQlQWxfXYXqI99JYHY94e84ylQWYGu6+i8='
WHERE
key_id = 'bbe8734f446a595cfd588c339034fc6a24f22efc7f7946388163f53236f464de'
AND (
token = 'TrPs63TCrfQlQWxfXYXqI99JYHY94e84ylQWYGu6+i8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)