UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6zThH/jmpCzq+ph30JH2FNuDJ0f1LbZ4opEdn5Dawo='
WHERE
key_id = '4d344a8a035d399beafa8f2b709390cc409e41df7e3fc24afba02c94b635aa73'
AND (
token = 'a6zThH/jmpCzq+ph30JH2FNuDJ0f1LbZ4opEdn5Dawo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)