UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6fm0tnHRgh1MoHMaW/7ndJPfWLShxwn3/LD/E9EGB5w='
WHERE
key_id = 'f1dad7f25410312f77499ec24ed518931362d3042fe55f605a8ea9938d90c426'
AND (
token = '6fm0tnHRgh1MoHMaW/7ndJPfWLShxwn3/LD/E9EGB5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)