UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HrlE2EIATEnij2sJJtAmJTphcNJgN79uo2KZL9m161A='
WHERE
key_id = '5a9340ddafdc722e912f504e82a246447814aa212a4a5ed78a26d65f49b2f19c'
AND (
token = 'HrlE2EIATEnij2sJJtAmJTphcNJgN79uo2KZL9m161A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)