UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qwraKk+c+dWSSbadD8Qg4DQLYhpsincHjxgYd677+c4='
WHERE
key_id = '4b8494a1b4de6f6c92ebd563fef13c2938a71115a74cb30a53427c85e07f21fe'
AND (
token = 'qwraKk+c+dWSSbadD8Qg4DQLYhpsincHjxgYd677+c4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)