UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qROTLFOwqBB+MTXAYy6iRCQzvPu68Pf0/j6sAYPMM1k='
WHERE
key_id = 'abbf43d7f4a78a2d50f52364b664ab0bc1d49e0c471dc2c824ec03e346e63371'
AND (
token = 'qROTLFOwqBB+MTXAYy6iRCQzvPu68Pf0/j6sAYPMM1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)