UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5yQrxSpJtiaDxj0KCsPAiSa6FJNTesHlIUaiy4yvgAI='
WHERE
key_id = 'f716993408a89bdcc3495caf584e47bc5cb0402ee9e15e828381b100a59014e6'
AND (
token = '5yQrxSpJtiaDxj0KCsPAiSa6FJNTesHlIUaiy4yvgAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)