UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'amMC4RTrQQNpB2r1R9VJLFmiAe5gmgcO29G3hh5JZNY='
WHERE
key_id = 'f2c43bb40921d5e40b0557c233863aecba6ec1bfebf75a3fb0691c2db0dba4c6'
AND (
token = 'amMC4RTrQQNpB2r1R9VJLFmiAe5gmgcO29G3hh5JZNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)