UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3KHmSHLVJY65TYTOqwFVKjbDVvSnSf4N1zeglxq+fNE='
WHERE
key_id = 'b52ed2d52ff358ea96bbf5e4f944487f2352535c51edde6746e8e36df9caa626'
AND (
token = '3KHmSHLVJY65TYTOqwFVKjbDVvSnSf4N1zeglxq+fNE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)