UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JuI8MaQksXh9oBqDzPUImJQf+ysDtVdnm9foWzGtnow='
WHERE
key_id = 'b304679056cf81ca71d0ff2ba424bd10cf8f886eef883c17658f8333cedf653a'
AND (
token = 'JuI8MaQksXh9oBqDzPUImJQf+ysDtVdnm9foWzGtnow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)