UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dP40tV+ya4UVr4+S+QW/PF2FGg/1kYw+5tM1C5TRU/k='
WHERE
key_id = '31a8394fb6c7700fba187c867f51686fa716887fd57f45dc8c2c193877635bb2'
AND (
token = 'dP40tV+ya4UVr4+S+QW/PF2FGg/1kYw+5tM1C5TRU/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)