UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dXYglLGkGOm0crDht5NhwEW+AsqKpByj/JKa29vNzcY='
WHERE
key_id = 'aec399a0d32a5ef27e67946d10b8984cb2f3cb77e9812e621101cedae7a56658'
AND (
token = 'dXYglLGkGOm0crDht5NhwEW+AsqKpByj/JKa29vNzcY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)