UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gS1YOzjySTu7BS8u209nGUsLvfUvz59eNHAIarugjWw='
WHERE
key_id = 'eb8883d6324601e43c8732e83b9b275a912a68d507c2ef8c9667ac7b7b29de50'
AND (
token = 'gS1YOzjySTu7BS8u209nGUsLvfUvz59eNHAIarugjWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)