UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KW/euQD1HDEQrAFPpuPSTFfVI++nT6qmqNG0RUt88uY='
WHERE
key_id = '7597b72f9b99a7f4f2a5a47033713b0fd6cce5da92668ebf6b0a612391702f99'
AND (
token = 'KW/euQD1HDEQrAFPpuPSTFfVI++nT6qmqNG0RUt88uY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)